package com.heima.admin.controller.v1;

import com.heima.admin.service.AdsensitiveService;
import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {
    @Autowired
    private AdsensitiveService adsensitiveService;
    /**
     * 列表查询
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return adsensitiveService.list(dto);
    }

    /**
     * 新增
     * @param adSensitive
     * @return
     */
    @Override
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.insert(adSensitive);
    }
    /**
     * 更新
     * @param adSensitive
     * @return
     */
    @Override
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.update(adSensitive);
    }
    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable Integer id) {
        return adsensitiveService.deleteById(id);
    }
}
